customShader = {}

-- VERTEX SHADER
customShader.vs = 
[[
    #ifdef GL_ES
    precision highp float;
    #endif
    attribute vec3 attrPos;
    attribute vec2 attrUV;
    uniform   mat4 u_MVP;
    varying vec2 uv;
    void main() {
        gl_Position = u_MVP * vec4(attrPos, 1.0);
        uv = attrUV;
    }
]]

-- FRAGMENT SHADER
customShader.fs = [[
    #ifdef GL_ES
    precision highp float;
    #endif
    uniform sampler2D ITex0;
    varying vec2 uv;
    float PI = 3.141592;
    
    float atan2(float y, float x)
    {
        bool s = (abs(x) > abs(y));
        if(x==0.0 && y==0.0){
            return 0.0;
        }
        if(s){
            return atan(y,x);
        }else{
            return PI/2.0 - atan(x,y);
        }
    }

    void main() {
        vec4 color = texture2D(ITex0,uv);
        color = vec4(color.rgb,0.5);
        //vec4 color = vec4(1.0,0.0,0.0,0.5);
        gl_FragColor = color;
    }
]]

return customShader